# vim:ts=4:sw=4:noet:
""" Basic block optimiser base class """

import c.compiler.cfg

class BBVisitor:
	def doMethod(self, meth):
		self.visit(meth.body.bb)

	def visit(self, bb, visited=[]):
		if bb.name in visited:
			return
		visited.append(bb.name)
		self.doBasicBlock(bb)
		for n in bb.nexts:
			self.visit(n, visited)
